using System;

namespace SharpMud.Server.Systems.Security.Entities.BuiltIn.Roles
{
	/// <summary>
	/// Represents a group of anonymous users
	/// </summary>
	public class Anonymous_Users : Systems.Security.Entities.IUserRole, Systems.Security.Entities.IEntity
	{
		private const string	_RoleName	=	"Anonymous Users";
		private const string	_RoleIDSeed	=	"{401E6E61-31FE-4d94-990D-AFE9178CE1A6}";

		private SecurityManager _SecurityManager;
		private System.Guid _RoleID;

		#region Public Constructors
		public Anonymous_Users()
			:this(SecurityManager.GlobalInstance)
		{
		}

		public Anonymous_Users(SecurityManager securityManager)
		{
			if(securityManager==null)
				throw new InvalidOperationException("There must be an instance of SharpMud.Server.Systems.SecurityManager available to this IUser");
			_SecurityManager = securityManager;
			this._RoleID = Security.Utility.AddGuids(securityManager.HostApp.___AppID, new System.Guid(_RoleIDSeed));
		}
		#endregion

		
		#region IUserRole Members

		public UserRoleReference GetReference()
		{
			return new UserRoleReference((IUserRole)this);
		}

		#endregion

		#region IEntity Members

		public string Name
		{
			get
			{
				return _RoleName;
			}
		}

		public Guid ID
		{
			get
			{
				return this._RoleID;
			}
		}

		EntityReference SharpMud.Server.Systems.Security.Entities.IEntity.GetReference()
		{
			return new EntityReference((IEntity)this);
		}

		#endregion
	}
}
